package com.jack.vipmis.vip.wei.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.MatrixVariable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.jack.vipmis.common.entity.enums.BooleanEnum;
import com.jack.vipmis.common.entity.search.Searchable;
import com.jack.vipmis.common.plugin.web.controller.BaseMovableController;
import com.jack.vipmis.common.web.bind.annotation.PageableDefaults;
import com.jack.vipmis.vip.wei.entity.TribuneCategory;

/**
 * 微贴信息Action
 * 
 * @author JackLiang
 * @version 1.0
 * @date 2014-7-11
 */
@Controller
@RequestMapping(value = "/wei/circle/category")
public class TribuneCategoryController extends BaseMovableController<TribuneCategory, Long> {

	public TribuneCategoryController() {
		setResourceIdentity("wei:circleCategory");
	}

	@Override
	protected void setCommonData(Model model) {
		model.addAttribute("booleanList", BooleanEnum.values());
	}

	// selectType multiple single
	@RequestMapping(value = { "select/{selectType}", "select" }, method = RequestMethod.GET)
	@PageableDefaults(sort = "weight=desc")
	public String select(Searchable searchable, Model model, @PathVariable(value = "selectType") String selectType,
			@MatrixVariable(value = "domId", pathVar = "selectType") String domId,
			@MatrixVariable(value = "domName", pathVar = "selectType", required = false) String domName) {

		this.permissionList.assertHasViewPermission();

		model.addAttribute("selectType", selectType);
		model.addAttribute("domId", domId);
		model.addAttribute("domName", domName);

		super.list(searchable, model);
		return "wei/circle/category/select";
	}
}
